<?php

/*
  VoIP Wholesale 1.0
  ------------------
  Document   : module_external_home
  Created on : Sep 14, 2011, 4:32:27 PM
  Author     : Milos Jovanovic <miloscode@gmail.com>
  Description:

 */
?>
<div id="page-title"><?=lang('term_families')?></div>

<div id="page-desc"><?=lang('text_families_desc')?></div>

<div class="ui-widget"> 
    <div id="content">
        <!-- PAGE CONTENT -->
        <div class="module-options">
            <button id="module-add-family"><?=lang('button_add_new_family')?></button>
        </div>
        
        <fieldset class="ui-widget-content ui-state-active">

            <legend class="ui-widget-content ui-state-active"><?=lang('form_filters')?></legend>
                
            <form action="<?=MODULE_SITE_URL?>/families/" method="post">
                <table>
                <tr>
                    <td>
                            <input type="text" name="data[short_name]" value="<?php if(isset($short_name) && strlen($short_name)>0 && strtoupper($short_name) != strtoupper(lang('term_short_name'))){print $short_name;}else{print lang('term_short_name');}?>" id="short_name_field" <?php if(isset($short_name)  && strlen($short_name)>0 && strtoupper($short_name) != strtoupper(lang('term_short_name'))){?>class="ui-state-error"<?php }?>/>
                    </td>
                    <td>
                        <select name="data[num_of_results]" <?php if(isset($num_of_results) && @$num_of_results != "none"){?>class="ui-state-error"<?php }?>>
                            <option value="none"><?=lang('form_max_results')?></option>
                            <option value="20" <?php if(@$num_of_results == "20"){?>selected="selected"<?php }?>>20</option>
                            <option value="50" <?php if(@$num_of_results == "50"){?>selected="selected"<?php }?>>50</option>
                            <option value="100" <?php if(@$num_of_results == "100"){?>selected="selected"<?php }?>>100</option>
                            <option value="200" <?php if(@$num_of_results == "200"){?>selected="selected"<?php }?>>200</option>
                            <option value="500" <?php if(@$num_of_results == "500"){?>selected="selected"<?php }?>>500</option>
                        </select>
                    </td>
                    <td>
                            <button id="filter-submit"><?=lang('term_search')?></button>
                    </td>
                </tr>
                </table>
            </form>                
        </fieldset>
        <br />
        <!-- table with the entries -->
	<table class="ui-widget ui-widget-content module-table-families" id="module-carriers-table"> 
		<thead> 
			<tr class="ui-widget-header "> 
				<!--<th class="module-1st">#</th> -->
				<th class="module-2nd"><?=lang('term_short_name')?></th> 
                <th class="module-3rd"><?=lang('term_description')?></th> 
				<th class="module-4th"><?=lang('term_trunks')?></th> 												
				<th class="module-6th"></th> 												
                <th class="module-7th"></th> 
			</tr> 
		</thead> 
		<tbody> 
		<?php $num=1;
		if(@is_array($families)){
		foreach($families as $family){
		?>
			<tr> 
                <!--<td><?=$num?></td>-->
                <td class="module-2nd family_no_<?=$family['id']?>"><?=$family['short_name']?></td> 
                <td class="module-3rd family_no_<?=$family['id']?>"><?=$family['description']?></td> 
				<td class="module-4th family_no_<?=$family['id']?>">[<a href="javascript:view_family_trunks('<?=$family['id']?>');"><?=lang('term_view_trunks')?></a>]</td>
				<td class="module-6th family_no_<?=$family['id']?>"> 		
					<button class="edit_family family_button_<?=$family['id']?>" name="<?=$family['id']?>">
						<span><?=lang('button_edit')?></span>
					</button>
				</td>		
				<td class="module-7th family_no_<?=$family['id']?>">
					<button class="delete_family family_button_<?=$family['id']?>" name="<?=$family['id']?>" rel="<?=$family['short_name']?>">
						<span><?=lang('button_delete')?></span>
					</button>
				</td> 				
			</tr> 
		<?php 
		$num++;}}?>
		</tbody> 
	</table> 		
    </div>    
</div>   
<div id="view_trunks" title="">
	<p>
		<span class="trunks_list"></span>
	</p>
</div>
<div id="delete" title="<?=lang('term_confirm_action')?>">
	<p>
		<?=lang('text_are_you_sure_you_want_to_delete_family')?>
		<span class="family_name"></span>?
	</p>
</div>
<div id="deletion_not_allowed" title="<?=lang('text_please_change_the_family_for_these_origin_trunks_first')?>">
	<p>
		<?=lang('text_you_must_change_family_for_the_following_origin_trunks')?>
		<span class="origin_trunks"></span>		
	</p>
</div>